[ToC] [Up] [Back] [Next] ... [Book Plug]
The Information Commons
.................... Introduction to HTML

4.10.1 TABLE Element

HTML Tables are contained within a TABLE element. The TABLE element denotes the range of the table, and defines properties of it. For example, the attribute BORDER indicates that the table should be drawn with a border around it and between each of the table's cells -- in the notation of tables, each box within the table is called a cell. In fact, BORDER is the only attribute supported by HTML 3 tables. The Netscape Navigator browser supports several other attributes, discussed a bit later.

The only two elements allowed inside a table are CAPTION, and TR. CAPTION defines a table caption, and can take one attribute -- ALIGN -- to define where the caption should be placed. Possible values are "top", "bottom" "left" and "right".

TR defines a Table Row -- a table is composed of any number of rows. Each row in turn contains TD (table data) or TH (table header) cells. The number of TD or TH elements defines the number of columns in the table, while the number of TR elements defines the number of rows. In general, TD elements are used for data, while TH elements are used for row or column headings.


TABLE Example: A Simple Table

Here is a simple table example, -- a table with 3 rows and 4 columns


<TABLE BORDER>
<caption align="bottom">This is the Table Caption</caption>
<TR> <TH>Heading 1 <TH> Heading 2 <TH> Heading 3 <TH> Heading 4 </TR>
<TR> <TD> 0.32 </TD> <TD> 1.2 </TD> <TD> 3.2 </TD> <TD> alpha </TD> </TR>
<TR> <TD> 0.44 </TD> <TD> 0.3 </TD> <TD> 7.2 </TD> <TD> beta </TD> </TR>
</TABLE>

This table is displayed as:

This is the Table Caption
Heading 1 Heading 2 Heading 3 Heading 4
0.32 1.2 3.2 alpha
0.44 0.3 7.2 beta


Things to Note


[ToC] [Up] [Back] [Next] ... [Book Plug]
.................... Introduction to HTML

© Ian Graham 1994-1996 Page Last Updated: 5 April 1996